package com.xuan.collegeblog.spider.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.moxi.mogublog.commons.entity.xuan.WeiBoCommentEntity;
import com.moxi.mogublog.xo.mapper.xuan.WeiBoCommentMapper;
import com.moxi.cloudblog.base.serviceImpl.SuperServiceImpl;
import com.xuan.collegeblog.spider.service.WeiBoCommentService;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class WeiBoCommentServiceImpl extends SuperServiceImpl<WeiBoCommentMapper, WeiBoCommentEntity> implements WeiBoCommentService {


    /**
     * @Description: 获得所有id
     * @param mid
     * @return java.util.List<com.xuan.collegeblog.spider.entity.CommentEntity>
     * @Author: huangzx
     * @Date: 2024/7/17 18:00
     */
    @Override
    public List<WeiBoCommentEntity> getAllByMid(String mid) {
        QueryWrapper<WeiBoCommentEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("mid", mid);
        List<WeiBoCommentEntity> commentEntities = list(queryWrapper);
        return commentEntities.isEmpty() ? Collections.emptyList() : commentEntities;
    }

    /**
     * @Description: 根据mid 删除数据
     * @param mid
     * @return boolean
     * @Author: huangzx
     * @Date: 2024/7/17 18:00
     */

    @Override
    public boolean deleteByUid(String mid) {
        QueryWrapper<WeiBoCommentEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("mid", mid);
        return remove(queryWrapper);
    }


}
